<?php use_helper('jQuery')?>

<div id="portal_list_header" class="ui-widget-header ui-corner-top">
    <div class="portal_list_column"><strong>Portal</strong></div>
    <div class="portal_list_column"><strong>Organización</strong></div>
    <div class="portal_list_column"><strong>Publicado</strong></div>
    <div class="portal_list_column"><strong>Activado</strong></div>
    <div class="portal_list_column portal_list_column_last"><strong>Acciones</strong></div>
</div>
<div id="portal_list_body">
<?php foreach ($portals as $i => $portal): ?>
    <div class="<?php echo fmod($i, 2) ? 'even ' : '' ?> portal_list_row">
        <div class="portal_list_column">
            <?php echo jq_link_to_remote($portal->getTitle(),
                    array(
                        'update' => 'component_right',
                        'url' => url_for('portal_show',$portal).'?goto_editor=1'
                    ), array(
                        'title' => $portal->getTitle()
                    ))?>
        </div>
        <div class="portal_list_column">
            <?php echo $portal->getOrganization() ?>
        </div>
        <div class="portal_list_column">
            <?php if ($portal->getPublished()): ?>
                <img alt="Sí" src="/images/util/check.png"/>
            <?php else: ?>
                <img alt="No" src="/images/util/cross.png"/>
            <?php endif; ?>
        </div>
        <div class="portal_list_column">
            <?php if ($portal->getIsEnabled()): ?>
                <img alt="Sí" src="/images/util/check.png"/>
            <?php else: ?>
                <img alt="No" src="/images/util/cross.png"/>
            <?php endif; ?>
        </div>
        <div class="portal_list_column portal_list_column_last ui-widget ui-helper-clearfix">
            <?php if ($portal->getIsEnabled()): ?>
                <a class="ui-button ui-widget ui-state-default ui-button-icon-only ui-state-hover"
                        role="button" aria-disabled="false" title="Button with icon only"
                        href="<?php echo url_for('portal_editor',$portal) ?>">
                    <span class="ui-button-icon-primary ui-icon ui-icon-pencil"></span>
                    <span class="ui-button-text">Editar</span>
                </a>
            <?php else: ?>
                <a class="ui-icon ui-icon-pencil" href=#></a>
                <a class="ui-button ui-widget ui-state-default ui-button-icon-only ui-state-hover"
                        role="button" aria-disabled="false" title="Button with icon only" href=#>
                    <span class="ui-button-icon-primary ui-icon ui-icon-pencil"></span>
                    <span class="ui-button-text">Editar</span>
                </a>
            <?php endif; ?>
            <?php echo jq_link_to_remote(
                    '<span class="ui-button-icon-primary ui-icon ui-icon-search"></span>
                    <span class="ui-button-text">Ver detalles</span>',
                array(
                    'update' => 'component_right',
                    'url' => url_for('portal_show',$portal).'?goto_editor=1',
                    'script' => true
                ), array(
                    'class' => 'ui-button ui-widget ui-state-default ui-button-icon-only ui-state-hover',
                    'title' => 'Ver detalles'
                )) ?>
        </div>
    </div>
<?php endforeach; ?>
</div>
